package org.esjsoftware.v2m.rim.util;

import java.util.Vector;

/**
 * 
 * @author Ernest
 * 
 */
public class Tools {
	/**
	 * 
	 * @param original
	 * @param regex
	 * @return String[]
	 */
	public static String[] slipt(String original, String regex) {
		// get start index
		int startIndex = 0;
		// put the data into Vector
		Vector v = new Vector();
		// return result of string array
		String[] str = null;
		// first index
		int index = 0;

		startIndex = original.indexOf(regex);
		while (startIndex < original.length() && startIndex != -1) {
			String temp = original.substring(index, startIndex);
			v.addElement(temp);
			index = startIndex + regex.length();
			startIndex = original.indexOf(regex, startIndex + regex.length());
		}
		v.addElement(original.substring(index));
		str = new String[v.size()];
		for (int i = 0; i < v.size(); i++) {
			str[i] = (String) v.elementAt(i);
		}
		return str;
	}
}
